
public class CurrentConditionsDisplay implements MyObserver, DisplayElement {
	private float temperature;
	private float humidity;
	private float pressure;
	private MySubject mySubject;
	
	public CurrentConditionsDisplay(MySubject weatherData) {
		this.mySubject = weatherData;
		weatherData.registerMyObserver(this);
	}
	
	public CurrentConditionsDisplay() {
		
	}
	
	@Override
	public void update(Object o) {
		if(o instanceof WeatherData) {
			WeatherData ob = (WeatherData)o;
			this.temperature = ob.getTemperature();
			this.humidity = ob.getHumidity();
			display();
		}
	}
	
	public void  display() {
		System.out.println("Current conditions: "+ temperature
				+ "F degrees and "+ humidity + "% humidity");
	}

	public void registerObserver(MySubject o) {
		o.registerMyObserver(this);
	}
	public void deregisterObserver(MySubject o){
		o.removeMyObserver(this);
		
	}
}
